<template>
	<view class="pageBg">
		<headerView title="活动详情">
			<view class="flex rightBox" @click="collection" url="/pages/my/navPreview/navPreview">
				<image class="collection" v-show="!data.is_favorite || data.is_favorite === 0" src="/static/images/collection.png" mode="heightFix"></image>
				<image class="collection collectionAct" v-show="data.is_favorite == 1" src="/static/images/collectionAct.png" mode="heightFix"></image>
				<view class="text">收藏</view>
			</view>
		</headerView>
		<view class="content" v-html="imgAddStyle(data.content)"></view>
	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				id: null,
				data: {},
			};
		},
		onLoad({ id }) {
			this.id = id;
			this.init();
		},
		methods: {
			async init() {
				const { data } = await this.$api.articleDetail({ id: this.id });
				this.data = data;
			},
			async collection() {
				const { data } = await this.$api.FavoriteEdit({ type: 3, id: this.id });
				this.init();
			},
		},
	};
</script>

<style lang="scss" scoped>
	.pageBg {
		.rightBox {
			align-items: center;
			.collection {
				width: 35rpx;
				height: 34rpx;
				margin-right: 5rpx;
			}
			.text {
				font-size: $uni-font-size-12;
				color: #999999;
			}
		}
		.content {
			width: $connet-width;
			margin: 0 auto;
		}
	}
</style>
